object = {}
object.x = {}
object.y = {}
object.wid = {}
object.hig = {}
object.counter = 0

object.tester = 0


function object.new(x,y,z,q)
	object.counter = object.counter + 1
	object.x[object.counter] = x
	object.y[object.counter] = y
	object.wid[object.counter] = z
	object.hig[object.counter] = q
end



function object.test()
	for i = 1, object.counter do
		hero.speed = hero.speed * (-1)
		if	hero.x + hero.wid > object.x[i] and 
			hero.x < object.x[i] + object.wid[i] and 
			hero.y + hero.hig > object.y[i]  and 
			hero.y < object.y[i] + object.hig[i]
		then	
				if hero.dir == 1 then hero.move.up()
				elseif hero.dir == 2 then hero.move.right()
				elseif hero.dir == 3 then hero.move.down()
				elseif hero.dir == 4 then hero.move.left()
				elseif hero.dir == 5 then hero.move.upright()
				elseif hero.dir == 6 then hero.move.downright()
				elseif hero.dir == 7 then hero.move.downleft()
				elseif hero.dir == 8 then hero.move.upleft()
				
				end
		
		end
		hero.speed = hero.speed * (-1)
	end

end


